date_time=0915
version=$2
aicard_num=$1

start_device=`expr $aicard_num \* 3`
end_device=`expr $aicard_num \* 3 + 2`
ph_card=`expr $aicard_num`

for device_id in `seq ${start_device} ${end_device}`
    do
            log_path=../../log/${date_time}/${version}/$device_id
            mkdir -p $log_path
            log_file=$log_path/test.log

            if [ -f $log_file ];then
                result=$(cat $log_file | grep  'FAILED')
                length=$(expr length "$result")
        
                if [[ length -gt 0 ]];
                then
                    flag=1
                fi
                # echo $log_file
                line=`cat $log_file | wc -l`
                # echo line:$line
                if [[ line -le 0 ]];
                then
                    flag=1
                fi
            else
                flag=1
            echo  "log file not exists!!!"
            fi

            if [[ flag -gt 0 ]];
            then
                echo -e "       device_$device_id RESULT: \E[31m [FAILED] \E[0m"
            else
                echo -e "       device_$device_id RESULT: \E[32m [PASS] \E[0m"
            fi            
done
